home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Prefs
/
MPPUpdateGads.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-12-26
|
22KB
|
718 lines
#include "/modepro.h"
#include "mpp.h"
#include "mppexterns.h"
UBYTE DepthToSlider[]=
{
// 0,1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 // requested depth
// 0,1,2,3,4,5,6,7,8,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32;
0,1,2,3,4,5,6,7,8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11
};
UBYTE SliderToDepth[]=
{
0,1,2,3,4,5,6,7,8,16,24,32
};
void SetPrefsGadgets(struct DefaultNode *n);
void UpdateGadgets(void)
{
struct DefaultNode *n;
NodeCnt=CountNodes(&MPSem->PromotionList[CurrentList]);
n=GetActiveNode();
SetDispGadgets(n);
SetFontGadgets(n);
SetSharedGadgets(n);
SetPublicGadgets(n);
SetHotKeyGadgets(n);
SetOptionGadgets(n);
Set3DGadgets(n);
SetPaletteGadgets(n);
SetPrefsGadgets(n);
SetBackdropGadgets(n);
if(ForcedEditMsg)
{
STRPTR name, type;
if(n)
{
name=n->Def_Node.ln_Name;
type=ListLabels[ListToCyc[n->Type]];
}
else
{
name=type="";
}
LG_SetGadgetAttrs(GadControl,GD_FE_ENTRY_NAME,
GTTX_Text, name,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_FE_ENTRY_TYPE,
GTTX_Text, type,
TAG_DONE);
/*
LG_SetGadgetAttrs(GadControl,GD_FE_SCREENNAME_DISP,
GTTX_Text, name,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_FE_PROGRAMNAME_DISP,
GTTX_Text, type,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_FE_SCREENMODE_DISP,
GTTX_Text, name,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_FE_SCREENNAME_DISP,
GTTX_Text, name,
TAG_DONE);*/
}
else
{
if(n)
{
LG_SetGadgetAttrs(GadControl,GD_TYPE,
GTCY_Active, ListToCyc[CurrentList],
GA_Disabled, ForcedEditMsg,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_LIST,
GTLV_Labels ,&MPSem->PromotionList[CurrentList],
GTLV_MakeVisible,LVActive,
GTLV_Selected ,LVActive,
GA_Disabled, ForcedEditMsg,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_REMOVE,
GA_Disabled, ForcedEditMsg,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_NAME,
GA_Disabled, ForcedEditMsg,// n->Type==PL_SCREENMODES,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_SELECT_NAME,
GA_Disabled, ForcedEditMsg,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_MOVE,
GTSL_Max, NodeCnt-1,
GTSL_Level, (NodeCnt-1)-LVActive,
GA_Disabled, ForcedEditMsg,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_NEW,
GA_Disabled, ForcedEditMsg,
TAG_DONE);
}
else
{
LG_SetGadgetAttrs(GadControl,GD_LIST,
GTLV_Labels, NULL,
GA_Disabled, TRUE,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_REMOVE,
GA_Disabled, TRUE,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_NAME,
GA_Disabled, TRUE,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_SELECT_NAME,
GA_Disabled, TRUE,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_MOVE,
GTSL_Max, 0,
GA_Disabled, TRUE,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_NEW,
GA_Disabled, 0,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_TYPE,
GTCY_Active, ListToCyc[CurrentList],
GA_Disabled, 0,
TAG_DONE);
}
}
}
UBYTE ModeName[33];
/*
void Set_OverscanGadget(struct DefaultNode *n)
{
LONG otype=1,
disabled=TRUE;
if(n)
{
switch(n->ModeSelect)
{
case 2:
case 3:
disabled=FALSE;
break;
}
otype=n->OverscanType;
}
LG_SetGadgetAttrs(GadControl,GD_OVERSCAN,
GTCY_Active ,otype-1,
GA_Disabled ,disabled,
TAG_DONE);
}
*/
void SetDispGadgets(struct DefaultNode *n)
{
WORD width=0,height=0;
BOOL d0=TRUE,d1=TRUE,d2=TRUE;
ULONG ms=0,msoff=0,otype=1;
ModeName[0]=0;
if(n)
{
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
d0=FALSE;
if(n->Type==PL_PUBLICSCREENS)
{
n->ModeSelect=max(2,n->ModeSelect);
msoff=2;
}
ms=n->ModeSelect;
otype=n->OverscanType;
switch(ms)
{
case MS_DONT_PROMOTE: /* Program default */
break;
case MS_PROMOTE_MONITOR: /* Monitor only */
d1=FALSE;
GetMonitorName(n->ModeID,ModeName,32);// (4.57.6)
/*{// (4.57.6)
struct MonitorInfo mi;// (4.57.6)
if(GetDisplayInfoData(NULL,(UBYTE *)&mi,sizeof(struct MonitorInfo),DTAG_MNTR,n->ModeID)>0)// (4.57.6)
if(mi.Mspc)// (4.57.6)
if(mi.Mspc->ms_Node.xln_Name)// (4.57.6)
strncpy(ModeName,mi.Mspc->ms_Node.xln_Name,32);// (4.57.6)
}*/// (4.57.6)
break;
case MS_PROMOTE_SCREENMODE: /* Screen Name */
case MS_PROMOTE_REQUESTER:
d1=d2=FALSE;
width =n->Width;
height =n->Height;
{
STRPTR workname;
if(workname=GetModeName(n->ModeID))
{
strncpy(ModeName,workname,32);
FreeVec(workname);
}
else
{
ModeName[0]=0;
}
}
break;
case MS_PROMOTE_BEST_MODE: // (4.57.11)
d1=d2=FALSE;// (4.57.11)
width =n->Width;// (4.57.11)
height =n->Height;// (4.57.11)
GetMonitorName(n->ModeID,ModeName,32);// (4.57.11)
break;// (4.57.11)
default:
strcpy(ModeName,MiscText[UNKNOWN_PROMOTION_MODE]);
break;
}
ModeName[32]=0;
}
}
LG_SetGadgetAttrs(GadControl,GD_SCREENMODE,
GTTX_Text ,ModeName,
GA_Disabled ,d0,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_MODESEL,
GTCY_Active ,ms-msoff,
GTCY_Labels ,&ModeSelLabels[msoff],
GA_Disabled ,d0,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_SELMODE,
GA_Disabled ,d1,
TAG_DONE);
/*
LG_SetGadgetAttrs(GadControl,GD_ENABLE_W_H,
GTCB_Checked ,(!(n->Flags & DNF_IGNORE_WH) && !d2),
GA_Disabled ,d2,
TAG_DONE);
*/
LG_SetGadgetAttrs(GadControl,GD_WIDTH,
GTIN_Number ,width,
GA_Disabled ,d2,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_HEIGHT,
GTIN_Number ,height,
GA_Disabled ,d2,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_OVERSCAN,
GTCY_Active ,otype-1,
GA_Disabled ,d2,
TAG_DONE);
SetPaletteGadgets(n);
}
void SetFontGadgets(struct DefaultNode *n)
{
ULONG d1=1,disable=~0,
type=0,
fasp=0;
if(n)
{
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
d1=0;
type=n->FontType;
if(type==SFONT_MP)
disable=0;
if(!disable)
{
fasp=n->Flags & FIXASPECT;
}
}
}
LG_SetGadgetAttrs(GadControl,GD_SFONT,
GTCY_Active, type,
GA_Disabled, d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_PICKFONT,
GA_Disabled, disable,
TAG_DONE);
WriteFontDisp(n);
LG_SetGadgetAttrs(GadControl,GD_FASPECT,
GTCB_Checked, fasp,
GA_Disabled, disable,
TAG_DONE);
}
void SetSharedGadgets(struct DefaultNode *n )
{
BOOL share=FALSE,d1=TRUE;
UBYTE *str=NULL;
if(n && V39)
{
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
d1=FALSE;
if(n->Flags & SHAREPENS)
{
share = TRUE;
str=n->LockedPens;
}
}
}
LG_SetGadgetAttrs(GadControl,GD_SHAREPENS,
GTCB_Checked ,share,
GA_Disabled ,d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_LOCKEDPENS,
GTST_String ,str,
GA_Disabled ,!(share),
TAG_DONE);
}
void SetPublicGadgets(struct DefaultNode *n)
{
BOOL pub =FALSE,
d1 =TRUE;
UBYTE *pubname=0;
if(n)
{
if((n->Type!=PL_PUBLICSCREENS) && !(n->Flags & DNF_NEVER_PROMOTE))
{
d1=FALSE;
if(n->PubOptions)
{
pub=TRUE;
pubname=n->PubName;
}
}
}
LG_SetGadgetAttrs(GadControl,GD_PUBOPT,
GTCB_Checked, pub,
GA_Disabled, d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_PUBNAME,
GTST_String, pubname,
GA_Disabled, !pub,
TAG_DONE);
}
void SetHotKeyGadgets(struct DefaultNode *n )
{
BOOL hk=FALSE,d1=TRUE;
UBYTE *str=NULL;
if(n)
{
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
d1=FALSE;
if(n->Flags & SCRHOTKEY)
{
hk = TRUE;
str=n->HotKey;
}
}
}
LG_SetGadgetAttrs(GadControl,GD_HOTKEYOPT,
GTCB_Checked ,hk,
GA_Disabled ,d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_HOTKEYSTR,
GTST_String ,str,
GA_Disabled ,!(hk),
TAG_DONE);
}
void SetPaletteGadgets(struct DefaultNode *n)
{
ULONG d1=TRUE,d2=TRUE;
if(n)
{
if( ( n->ModeSelect==MS_PROMOTE_SCREENMODE ||
n->ModeSelect==MS_PROMOTE_REQUESTER ||
n->ModeSelect==MS_PROMOTE_BEST_MODE) &&
!(n->Flags & DNF_NEVER_PROMOTE))
{
d1=FALSE;
if(n->Flags & DNF_PALETTE)
d2=FALSE;
}
}
LG_SetGadgetAttrs(GadControl,GD_PALETTE,
GTCB_Checked ,!d2,
GA_Disabled ,d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_EDITPALETTE,
GA_Disabled ,d2,
TAG_DONE);
SetDepthGadgets(n);
}
void SetDepthGadgets(struct DefaultNode *n)
{
ULONG maxdepth =1,
depth =0;
BOOL disslide =TRUE;
BOOL discheck =TRUE,
checked =FALSE;
struct DimensionInfo di;
if(n)
{
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
n->Depth=max(1,n->Depth);
if( n->ModeSelect==MS_PROMOTE_SCREENMODE ||
n->ModeSelect==MS_PROMOTE_REQUESTER)
// n->ModeSelect==MS_PROMOTE_BEST_MODE)// (4.58.1)
{
discheck=FALSE;
if(n->Flags & (DEPTH | DNF_PALETTE))
{
disslide = FALSE;
if(GetDisplayInfoData(NULL,(UBYTE *)&di,sizeof(di),DTAG_DIMS,n->ModeID)>0)// (4.57.1)
{// (4.57.1)
maxdepth=min(di.MaxDepth,32);// Can only handle upto 32bit (4.57.1)// (4.57.17)
}// (4.57.1)
else// (4.57.1)
{// (4.57.1)
maxdepth=32;// (4.57.1)// (4.57.18)
}// (4.57.1)
n->Depth=min(n->Depth,maxdepth);// (4.57.1)
// (4.57.1)
checked=n->Flags & DEPTH;
}
}
if(n->ModeSelect==MS_PROMOTE_BEST_MODE)// (4.57.15)
{// (4.57.15)
discheck=FALSE;// (4.57.15)
if(n->Flags & (DEPTH | DNF_PALETTE))// (4.57.15)
{// (4.57.15)
disslide = FALSE;// (4.57.15)
maxdepth = 32;// (4.57.15)
n->Depth = min(n->Depth,maxdepth);// (4.57.15)
checked = n->Flags & DEPTH;// (4.57.15)
} // (4.57.15)
}// (4.57.15)
maxdepth=DepthToSlider[maxdepth];// (4.57.19)
depth=DepthToSlider[n->Depth];// (4.57.19)
}
}
WriteColorDisp(n);
LG_SetGadgetAttrs(GadControl,GD_DODEPTH,
GTCB_Checked ,checked,
GA_Disabled ,discheck,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_DEPTH,
GTSL_Max ,maxdepth,
GTSL_Level ,depth,
GA_Disabled ,disslide,
TAG_DONE);
}
void SetOptionGadgets(struct DefaultNode *n)
{
BOOL d1=TRUE,d2=TRUE,as=0,center=0,ilbm=0,planar=0,behind=0,blankb=0;
if(n)
{
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
d1 =FALSE;
as =n->AutoScroll;
center=n->CenterFlags;
blankb=n->Flags & DNF_BLANK_BORDER;
behind=n->Flags & DNF_BEHIND;
if(V39)
{
d2 =FALSE;
ilbm =n->Flags & INTERLEAVE;
planar=n->Flags & DNF_FORCEPLANAR;
}
}
}
LG_SetGadgetAttrs(GadControl,GD_AUTOSCROLL,
GTCB_Checked, as,
GA_Disabled, d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_CENTER,
GTCY_Active, center,
GA_Disabled, d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_INTERLEAVE,
GTCB_Checked, ilbm,
GA_Disabled, d2,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_FORCE_PLANAR,
GTCB_Checked, planar,
GA_Disabled, d2,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_BEHIND,
GTCB_Checked, behind,
GA_Disabled, d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_BLANK_BORDER,
GTCB_Checked, blankb,
GA_Disabled, d1,
TAG_DONE);
}
void Set3DGadgets(struct DefaultNode *n)
{
BOOL look3d=FALSE,d1=TRUE,d2=TRUE,default3d=0,setpens=0;
if(n)
{
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
d1=FALSE;
if(look3d=n->Look3D)
{
d2=FALSE;
if(n->Flags & DNF_3D_DEFAULT)
{
default3d=1;
}
else
setpens=1;
}
}
}
if(setpens)
SetPenValues(n->Pens);
else
SetPenValues(NULL);
LG_SetGadgetAttrs(GadControl,GD_LOOK3D,
GTCB_Checked, look3d,
GA_Disabled, d1,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_3D_DEFAULT,
GTCB_Checked, default3d,
GA_Disabled, d2,
TAG_DONE);
}
void SetPrefsGadgets(struct DefaultNode *n)
{
/*
LG_SetGadgetAttrs(GadControl,GD_CANCEL,
GA_Disabled, ForcedEdit,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_USE,
GA_Disabled, ForcedEdit,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_SAVE,
GA_Disabled, ForcedEdit,
TAG_DONE);
*/
}
void SetPenValues(WORD *pens)
{
ULONG pen,maxlenpng;
LG_SetGadgetAttrs(GadControl,GD_PENLIST,
GTLV_Labels,~0,TAG_DONE);
if(pens)
{
for(pen=0;pen<NumDriPens;pen++)
{
stci_d(&PenNames[pen][PenNameLength[pen]],pens[pen]);
}
LG_SetGadgetAttrs(GadControl,GD_PENVAL,
GA_Disabled ,FALSE,
GTIN_Number ,pens[ActivePen],
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_RESETPENS,
GA_Disabled ,FALSE,
TAG_DONE);
}
else
{
for(pen=0;pen<NumDriPens;pen++)
{
PenNames[pen][PenNameLength[pen]]=0;
}
LG_SetGadgetAttrs(GadControl,GD_PENVAL,
GA_Disabled ,TRUE,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_RESETPENS,
GA_Disabled ,TRUE,
TAG_DONE);
}
LG_SetGadgetAttrs(GadControl,GD_PENLIST,
GTLV_Labels ,&PenList,
GTLV_MakeVisible ,ActivePen,
GTLV_Selected ,ActivePen,
GA_Disabled ,!pens,
TAG_DONE);
//LG_SetGadgetAttrs(GadControl,GD_PENNAME,
// GTTX_Text,NULL,TAG_DONE);
maxlenpng=min(31,PenNameLength[ActivePen]);
strncpy(PenNameGad,PenNames[ActivePen],maxlenpng);
PenNameGad[maxlenpng]=0;
//LG_SetGadgetAttrs(GadControl,GD_PENNAME,
// GTTX_Text,PenNameGad,TAG_DONE);
WritePenNameDisp(PenNameGad);
}
void SetBackdropGadgets(struct DefaultNode *n )
{
BOOL d1=TRUE;
UBYTE *str=NULL;
LONG backdroptype=0;
if(n && V39)
{
n->BackdropType=max(n->BackdropType,0);
n->BackdropType=min(n->BackdropType,2);
if(!(n->Flags & DNF_NEVER_PROMOTE))
{
d1=0;
backdroptype=n->BackdropType;
}
}
LG_SetGadgetAttrs(GadControl,GD_BACKDROPOPT,
GTCY_Active, backdroptype,
GA_Disabled, d1,
TAG_DONE);
{
LONG l;
for(l=0;l<3;l++)
LG_RemoveGadgets(BackdropControl[l]);
}
LG_AddGadgets(Win,BackdropControl[backdroptype]);
switch(backdroptype)
{
case 1:
str=n->BackdropFile;
if(str)
str=FilePart(str);
LG_SetGadgetAttrs(GadControl,GD_BACKDROPFILENAME,
GTTX_Text , str,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_BACKDROPPICK,
TAG_DONE);
LG_SetGadgetAttrs(GadControl,GD_BACKDROPCENTER,
GTCB_Checked ,n->BackdropFlags & BF_CENTER,
TAG_DONE);
break;
case 2:
if(V39 && (BackdropPen>=0))
{
SetRGB32(&Scr->ViewPort,BackdropPen,
n->BackdropRGB.Red,
n->BackdropRGB.Green,
n->BackdropRGB.Blue);
}
break;
}
}
// 6 11 16 39 40 49